Skip to content

Conversation

@rickeylev
Copy link
Collaborator

This adds attributes and fields for storing the runtimes ABI flags value, i.e. sys.abiflags.

For freethreaded interpreters, the abi flags contain t, which is used creating e.g.
virtualenvs.

The attribute can be directly specified, or if it's not, will be computed based on the
--py_freethreaded flag.

@rickeylev rickeylev requested a review from aignas as a code owner November 11, 2024 06:53
@rickeylev rickeylev force-pushed the feat.pyruntime.abiflags branch from b0014b0 to c94ff29 Compare November 11, 2024 06:53
@rickeylev rickeylev force-pushed the feat.pyruntime.abiflags branch from c94ff29 to 72e8f87 Compare November 11, 2024 06:57
@rickeylev rickeylev added this pull request to the merge queue Nov 11, 2024
interpreter_version_info["minor"],
)

abi_flags = ctx.attr.abi_flags
Copy link
Collaborator

@aignas aignas Nov 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about doing

diff --git a/python/private/hermetic_runtime_repo_setup.bzl b/python/private/hermetic_runtime_repo_setup.bzl
index 3f7bb5d7..207d021b 100644
--- a/python/private/hermetic_runtime_repo_setup.bzl
+++ b/python/private/hermetic_runtime_repo_setup.bzl
@@ -198,6 +198,10 @@ def define_hermetic_runtime_toolchain_impl(
             _IS_FREETHREADED: "cpython-{major}{minor}t".format(**version_dict),
             "//conditions:default": "cpython-{major}{minor}".format(**version_dict),
         }),
+        abi_info = select({
+            _IS_FREETHREADED: "t",
+            "//conditions:default": "",
+        }),
     )

     py_runtime_pair(

Instead of depending on the _py_freethreaded_flag implementation?

Merged via the queue into bazel-contrib:main with commit 4e61031 Nov 11, 2024
4 checks passed
@rickeylev rickeylev deleted the feat.pyruntime.abiflags branch April 5, 2025 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants